import { injectable } from 'tsyringe';
import type { ILogger } from '../domain/interfaces/ILogger';

@injectable()
export class Logger implements ILogger {
  info(message: string, meta?: any): void {
    console.info('[INFO]', message, meta || '');
  }
  error(message: string, error?: Error, meta?: any): void {
    console.error('[ERROR]', message, error ? error.stack || error.message : '', meta || '');
  }
  warn(message: string, meta?: any): void {
    console.warn('[WARN]', message, meta || '');
  }
  debug(message: string, meta?: any): void {
    if (process.env.NODE_ENV !== 'production') {
      console.debug('[DEBUG]', message, meta || '');
    }
  }
}

export default Logger;
